var $ = exports
var _ = require("rosa/html4")

var assert = require("assert")
var renderer = require("rosa/html4Render")
var render = renderer.render
var renderPart = renderer.renderPart

$.testBasic = function() {
	var rosa = _.html(
	  _.head(
	  	_.title("TTTTT")
	  ),
	  _.body({"class":"klass"},
	  	"BBBBB"
	  )
	)

	assert.equal( 
		'<!DOCTYPE html>\n'+
		'<html>'+
			'<head>'+
				'<title>TTTTT</title>'+
			'</head>'+
			'<body class="klass">BBBBB</body>'+
		'</html>',
		render(rosa)
	)
}

$.testSanitization = function() {
	assert.equal(
		'<div class="something">a&lt;b &amp; c</div>',
		renderPart(_.div({'cl\'\"=ass=':"some\"thing" },"a<b & c"))
	)
}

$.testSimpleTags = function() {
	assert.equal(
		'<img src="/a">', 
		renderPart(_.img({src:"/a"}))
	)
}
